<template>
    <Form
            :form-items="formItems"
    ></Form>
</template>

<script>
    import Form from '../../../../common-util/src/components/page/Form.vue'
    export default {
        components:{
            Form
        },
        data(){
            return {
                formItems:[
                    {
                        field: {
                            name: 'name'
                        },
                        element:{
                            label: '名称',
                            required: true
                        }
                    },
                    {
                        field: {
                            name: 'areaMin'
                        },
                        element:{
                            label: '最小值',
                            type: 'text',
                            modelModifier: 'number',
                            validate: 'integer',
                            validator:(rule, value, callback)=>{
                                if(value && value <= 0){
                                    callback(new Error('请输入正整数'));
                                }else{
                                    callback()
                                }
                            },
                            required: (form)=>{
                                return !form.areaMax
                            }
                        }
                    },
                    {
                        field: {
                            name: 'areaMax'
                        },
                        element:{
                            label: '最大值',
                            type: 'text',
                            modelModifier: 'number',
                            validate: 'integer',
                            validator:(rule, value, callback)=>{
                                if(value && value <= 0){
                                    callback(new Error('请输入正整数'));
                                }else{
                                    callback()
                                }
                            },
                            required: (form)=>{
                                return !form.areaMin
                            }
                        }
                    },
                    {
                        field: {
                            name: 'seq'
                        },
                        element:{
                            type: 'inputNumber',
                            label: '排序',
                            required: true
                        }
                    },
                    {
                        element:{
                            type: 'button',
                            button:[
                                {
                                    action: 'submit',
                                    requestMethod:'post',
                                    url: this.$baseURL.house + '/house/areainterval',
                                    label: '保存'
                                },
                                {
                                    action: 'reset',
                                    label: '重置',
                                    type: 'default'
                                }
                            ]
                        }
                    }
                ]
            }
        },
        methods:{
        }
    }
</script>

<style scoped>

</style>